#include <stdio.h>
#include <stdlib.h>

int add(int x, int y);
int subtract(int x, int y);
int domath(int (*mathop)(int, int), int x, int y);

int add(int x, int y) {
    int z;
    z = x + y;
    return z;
}

int subtract(int x, int y) {
    int z;
    z = x - y;
    return z;
}

int domath(int (*mathop)(int, int), int x, int y) {
    return (*mathop)(x, y);
}

int main(int argc, char *argv[]) {
    int arg1;
    int arg2;
    //printf("%d\t%d\n", arg1, arg2);
    if (argc > 2) {
        arg1 = atoi(argv[1]);
        arg2 = atoi(argv[2]);
    } else {
        arg1 = 123;
        arg2 = 32;
    }
    printf("%d\t%d\n", arg1, arg2);

    int a;
    a = domath(add, arg1, arg2);
    printf("Add gives: %d\n", a);

    int b;
    b = domath(subtract, arg1, arg2);
    printf("Subtract gives: %d\n", b);

    exit(0);
}
